function selectPack(object){
    var i,sidLen,attrLen, s,sidPack = [],attrPack = [],sid,attribute;
    sidLen = object.sid.length;
    attrLen = object.attr.length;

    if(sidLen > 1 && attrLen > 1 && sidLen == attrLen)
    {
        for(s in object)
        {
            if(s == 'sid'){
                sidPack = object[s];
            }
            if(s == 'attr')
            {
                attrPack = object[s];
            }
        }
        for(i=0;i <= sidPack.length;i++)
        {
            selectTb(sidPack[i],attrPack[i]);
        }
    }
    else if(sidLen != attrLen)
    {
        throw new SyntaxError('Error!!! SID and ATTR prpperty length different!!!');
    }
    else
    {
        sid = object.sid;
        attribute = object.attr;
        selectTb(sid,attribute);
    }
}
function selectTb(sid,attribute)
{

    var select,li,txt,id,i,selectOption,optLen;
    var select = $('#'+sid);
    var li = $(select).find("ul li");
    li.click(function(e){
        txt = $(this).text();
        id = $(this).find("a").data("id");
        $("#"+sid+" input:first-child").val(txt).attr("id",id);
        selectOption = $("#MenuItem_"+attribute+" option");
        optLen = selectOption.length;
        for(i=0;i < optLen;i+=1)
        {
            if(selectOption[i].value == id)
            {
                $(selectOption[i]).attr("selected","selected");
            }
            else
            {
                if(selectOption[i]+":selected"){
                    $(selectOption[i]).removeAttr("selected");
                }
            }
        }
    });
}


//---------END-selectTb-----------------------------------------------------------------------

